<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
<meta charset="utf-8">
<head th:include="include :: header"></head>
<body class="white-bg">
<div class="wrapper wrapper-content animated fadeInRight ibox-content">
	<form class="form-horizontal m" id="form-config-edit" th:object="${sysConfig}">

		<div class="form-group">
			<label class="col-sm-3 control-label">语言设置：</label>
			<div class="col-sm-5">
				<select id="sys_set_language" name="sys_set_language" class="form-control m-b" th:with="type=${@dict.getType('sys_language')}">
					<option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}" th:field="*{sys_set_language}"></option>
				</select>
			</div>
		</div>
		<div class="form-group">
			<label class="col-sm-3 control-label">系统货币设置：</label>
			<div class="col-sm-5">
				<select id="sys_set_tokin" name="sys_set_tokin" class="form-control m-b">
					<option th:each="tokin : ${tokinList}" th:text="${tokin.fullName}" th:value="${tokin.shortName}" th:field="*{sys_set_tokin}"></option>
				</select>
			</div>
		</div>

		<div class="form-group">
			<label class="col-sm-3 control-label ">默认入金手续费率：</label>
			<div class="col-sm-5">
				<input class="form-control" type="text" th:field="*{pey_set_default_in_rate}" id="pey_set_default_in_rate" name="pey_set_default_in_rate"/>
			</div>
		</div>

		<div class="form-group">
			<label class="col-sm-3 control-label">默认出金手续费率：</label>
			<div class="col-sm-5">
				<input class="form-control" type="text" th:field="*{pey_set_default_out_rate}" name="pey_set_default_out_rate" id="pey_set_default_out_rate">
			</div>
		</div>
		<div class="form-group">
			<label class="col-sm-3 control-label">默认代理商分润比率：</label>
			<div class="col-sm-5">
				<input class="form-control" type="text" th:field="*{pey_set_default_agent_rate}"  name="pey_set_default_agent_rate" id="pey_set_default_agent_rate" >
			</div>
		</div>

		<div class="form-group">
			<label class="col-sm-3 control-label">实名认证设置：</label>
			<div class="col-sm-5">
				<div class="radio-box" th:each="dict : ${@dict.getType('pay_user_cert_type')}">
					<input  th:checked="${sysConfig.pey_set_user_cert_type == dict.dictValue}" type="radio" th:id="${dict.dictCode}" name="pey_set_user_cert_type" th:value="${dict.dictValue}" >
					<label th:for="${dict.dictCode}" th:text="${dict.dictLabel}"></label>
				</div>
			</div>
		</div>
		<div class="form-group">
			<label class="col-sm-3 control-label">注册设置：</label>
			<div class="col-sm-5">
				<div class="radio-box" th:each="dict : ${@dict.getType('pay_user_regist_type')}">
					<input th:checked="${sysConfig.pey_set_user_reg_type == dict.dictValue}" type="radio" th:id="${dict.dictCode}" name="pey_set_user_reg_type" th:value="${dict.dictValue}" >
					<label th:for="${dict.dictCode}" th:text="${dict.dictLabel}"></label>
				</div>
			</div>
		</div>

		<div class="form-group">
			<label class="col-sm-3 control-label">支付宝入金金额限制：</label>
			<div class="col-sm-2">
				<input class="form-control" type="text"th:field="*{pey_set_zfb_in_min}" name="pey_set_zfb_in_min" id="pey_set_zfb_in_min">
			</div>
			<div style="float:left">-</div>
			<div class="col-sm-2">
				<input class="form-control" type="text" th:field="*{pey_set_zfb_in_max}" name="pey_set_zfb_in_min" id="pey_set_zfb_in_max">
			</div>
		</div>
		<div class="form-group">
			<label class="col-sm-3 control-label">微信入金金额限制：</label>
			<div class="col-sm-2">
				<input class="form-control" type="text" th:field="*{pey_set_wx_in_min}" name="pey_set_wx_in_min" id="pey_set_wx_in_min">
			</div>
			<div style="float:left">-</div>
			<div class="col-sm-2">
				<input class="form-control" type="text" th:field="*{pey_set_wx_in_max}" name="pey_set_wx_in_max" id="pey_set_wx_in_max">
			</div>
		</div>
		<div class="form-group">
			<label class="col-sm-3 control-label">银行卡入金金额限制：</label>
			<div class="col-sm-2">
				<input class="form-control" type="text" th:field="*{pey_set_yhk_in_min}" name="pey_set_yhk_in_min" id="pey_set_yhk_in_min">
			</div>
			<div style="float:left">-</div>
			<div class="col-sm-2">
				<input class="form-control" type="text" th:field="*{pey_set_yhk_in_max}" name="pey_set_yhk_in_max" id="pey_set_yhk_in_max">
			</div>
		</div>
		<div class="form-group">
			<label class="col-sm-3 control-label">代理结算周期(天)：</label>
			<div class="col-sm-5">
				<input class="form-control" type="text" th:field="*{pey_set_agent_order_cycle}" name="pey_set_agent_order_cycle" id="pey_set_agent_order_cycle">
			</div>
		</div>
		<div class="form-group">
			<label class="col-sm-3 control-label">系统钱包地址：</label>
			<div class="col-sm-5">
				<input class="form-control" type="text" th:field="*{pey_set_sys_money_adress}" name="pey_set_sys_money_adress" id="pey_set_sys_money_adress">
			</div>
		</div>
		<div class="form-group">
			<label class="col-sm-3 control-label">系统钱包地址密匙：</label>
			<div class="col-sm-5">
				<input class="form-control" type="text" th:field="*{pey_set_sys_money_adress_key}" name="pey_set_sys_money_adress_key" id="pey_set_sys_money_adress_key">
			</div>
		</div>
		<div class="form-group">
			<label class="col-sm-3 control-label">系统URL配置：</label>
			<div class="col-sm-5">
				<input class="form-control" type="text" th:field="*{pey_set_sys_url}" name="pey_set_sys_url" id="pey_set_sys_url">
			</div>
		</div>
		<div class="form-group">
			<label class="col-sm-3 control-label">聊天服务器：</label>
			<div class="col-sm-5">
				<input class="form-control" type="text" th:field="*{pey_set_sys_ip}" name="pey_set_sys_ip" id="pey_set_sys_ip">
			</div>
		</div>
		<div class="form-group"></div>
		<div class="form-group">
			<label class="col-sm-3 control-label"></label>
			<div class="col-sm-5">
				<div class="btn-group-sm hidden-xs" id="toolbar" role="group">
					<a class="btn btn-success col-sm-5" onclick="submitHandler()" >
						<i class="fa fa-plus"></i> 保存
					</a>
				</div>
			</div>
		</div>
	</form>
</div>
<div th:include="include::footer"></div>
<script th:src="@{/ajax/libs/select/select2.js}"></script>
<script>
    $("#form-config-edit").validate({
        rules:{
            sys_set_language:{
                required:true,
            },
            sys_set_tokin:{
                required:true,
            },
            pey_set_default_in_rate:{
                required:true,
            },
            pey_set_default_out_rate:{
                required:true,
            },
            pey_set_default_agent_rate:{
                required:true,
            },
            pey_set_user_cert_type:{
                required:true,
            },
            pey_set_user_reg_type:{
                required:true,
            },
            pey_set_zfb_in_min:{
                required:true,
            },
            pey_set_zfb_in_max:{
                required:true,
            },
            pey_set_wx_in_min:{
                required:true,
            },
            pey_set_wx_in_max:{
                required:true,
            },
            pey_set_yhk_in_min:{
                required:true,
            },
            pey_set_yhk_in_max:{
                required:true,
            },
            pey_set_agent_order_cycle:{
                required:true,
            },
            pey_set_sys_money_adress:{
                required:true,
            },
            pey_set_sys_money_adress_key:{
                required:true,
            },
            pey_set_sys_url:{
                required:true,
            },
            pey_set_sys_ip:{
                required:true,
            },
        }
    });

    function submitHandler() {
        if ($.validate.form()) {
            add();
        }
    }

    function add() {
        $.ajax({
            cache : true,
            type : "POST",
            url : ctx + "manager/sys_init",
            data : {
                "sys_set_language":  $("select[name='sys_set_language']").val(),
                "sys_set_tokin":  $("select[name='sys_set_tokin']").val(),
                "pey_set_default_in_rate":  $("input[name='pey_set_default_in_rate']").val(),
                "pey_set_default_out_rate":  $("input[name='pey_set_default_out_rate']").val(),
                "pey_set_default_agent_rate":  $("input[name='pey_set_default_agent_rate']").val(),
                "pey_set_user_cert_type":  $('input[name="pey_set_user_cert_type"]:checked').val(),
                "pey_set_user_reg_type":  $('input[name="pey_set_user_reg_type"]:checked').val(),
                "pey_set_zfb_in_min":  $("input[name='pey_set_zfb_in_min']").val(),
                "pey_set_zfb_in_max":  $("input[name='pey_set_zfb_in_max']").val(),
                "pey_set_wx_in_min":  $("input[name='pey_set_wx_in_min']").val(),
                "pey_set_wx_in_max":  $("input[name='pey_set_wx_in_max']").val(),
                "pey_set_yhk_in_min":  $("input[name='pey_set_yhk_in_min']").val(),
                "pey_set_yhk_in_max":  $("input[name='pey_set_yhk_in_max']").val(),
                "pey_set_agent_order_cycle":  $("input[name='pey_set_agent_order_cycle']").val(),
                "pey_set_sys_money_adress":  $("input[name='pey_set_sys_money_adress']").val(),
                "pey_set_sys_money_adress_key":  $("input[name='pey_set_sys_money_adress_key']").val(),
                "pey_set_sys_url":  $("input[name='pey_set_sys_url']").val(),
                "pey_set_sys_ip":  $("input[name='pey_set_sys_ip']").val()
            },
            async : false,
            error : function(request) {
                $.modal.alertError("系统错误");
            },
            success : function(data) {
                $.operate.successCallback(data);
            }
        });
    }

</script>
</body>
</html>
